﻿<!Doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>后台管理</title>
    <link rel="stylesheet" href="../public/css/bootstrap.min.css">
    <link rel="stylesheet" href="../public/css/bootstrap-table.min.css">
    <link rel="stylesheet" href="../public/css/main.css">
    <link rel="stylesheet" href="../public/layui/css/layui.css">
</head>
<body>
    <ul class="layui-nav layui-nav-tree layui-nav-side layui-bg-cyan" lay-filter="test">
        <li class="layui-nav-item"><a href="/LeaveBack/views/index.html">主页</a></li>
        <li class="layui-nav-item layui-nav-itemed"><a href="/LeaveBack/views/show.html">请假记录</a></li>
        <li class="layui-nav-item"><a href="/LeaveBack/views/changecls.html">转专业处理</a></li>
    </ul>
    <div id="content">
        <button type="button" class="btn btn-info" onclick="downloadTable()">导出表格</button>
        <table id="table"></table>
    </div>
    
    <script src="../public/jquery-3.3.1.min.js"></script>
    <script src="../public/layui/layui.js"></script>
    <script src="../public/layer/layer.js"></script>
    <script src="../public/bootstrap-table.min.js"></script>
    <script src="../public/bootstrap-table-zh-CN.min.js"></script>
    <script>
        function downloadTable() {
//                window.open("https://codeload.github.com/douban/douban-client/legacy.zip/master");
            window.location.href='/LeaveBack/leave/downloadExcel';
        }

        $("#table").bootstrapTable({ // 对应table标签的id
            method: "get",
            url: "/LeaveBack/leave/getAllInfo", // 获取表格数据的url
            contentType: "application/x-www-form-urlencoded",
            search:true,
            cache: false, // 设置为 false 禁用 AJAX 数据缓存， 默认为true
            pagination: true, // 在表格底部显示分页组件，默认false
            pageSize: 10, // 页面数据条数
            pageNumber: 1, // 首页页码
            queryParams:function(params) {  //发送给服务端的参数
                return {
                    pageIndex : params.offset/params.limit+1,
                    search: params.search       
                }
            },
            sidePagination: 'server', // 设置为服务器端分页
            columns: [
                {
                    field: 'studentId',  
                    title: '学生ID',  
                    align: 'center', 
                    valign: 'middle' 
                },{
                    field: 'studentName',  
                    title: '学生姓名',  
                    align: 'center', 
                    valign: 'middle' 
                },{
                    field: 'department',  
                    title: '所在学院',  
                    align: 'center', 
                    valign: 'middle'  
                },{
                    field: 'className',  
                    title: '所在班级',  
                    align: 'center', 
                    valign: 'middle'  
                },{
                    field: 'phone',  
                    title: '联系方式',  
                    align: 'center', 
                    valign: 'middle'  
                },{
                    field: 'beginTime',  
                    title: '开始时间',  
                    align: 'center', 
                    valign: 'middle'  
                },{
                    field: 'endTime', 
                    title: '结束时间',
                    align: 'center',  
                    valign: 'middle'  
                },{
                    field: 'status', 
                    title: '状态', 
                    align: 'center', 
                    valign: 'middle' 
                }
            ]
        });
    </script>
</body>
</html>